<html>
<script>

const svgUrl = 'raster.svg'
const width  = 800
const height = 600

const svgImage = new Image()
svgImage.addEventListener('load', () => {
    const canvas = document.createElement('canvas')
    canvas.width  = width
    canvas.height = height

    const ctx = canvas.getContext('2d')
    ctx.drawImage(svgImage, 0, 0, width, height)

    const pngImage = document.createElement('img')
    pngImage.src = canvas.toDataURL('image/png')
    document.body.appendChild(pngImage)
})
svgImage.src = svgUrl

</script>
</html>
